package leetcode.greed;

/**
 * @author mazouri
 * @create 2021-12-27 19:02
 */
public class _122_maxProfit {
    public int maxProfit(int[] prices) {
        int result = 0;
        for (int i = 1; i < prices.length; i++) {
            result += Math.max(prices[i] - prices[i - 1], 0);
        }
        return result;
    }
}
